// 入驻申请
<template>
   <div class="search">
     <Row>
        <Card>
          <Row class="operation">
            <Form inline :label-width="100" ref="searchForm" :model="searchForm" label-position="right">
              <Button @click="getDataList()" icon="md-refresh">刷新</Button>
              <!-- <Button @click="delAll" icon="md-trash">批量删除</Button> -->
            </Form>
          </Row>

          <Row>
            <Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort"></Table>
          </Row>

          <Row type="flex" justify="end" class="page">
            <Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10,20,50]" size="small" show-total show-elevator show-sizer></Page>
          </Row>
        </Card>
     </Row>
   </div> 
</template>

<script>
export default {
  data(){
    return{ 
      total:0,
      loading: true, // 表单加载状态
      data:[],//表单数据
      searchForm:{
        pageSize:10,
        pageNumber:1
      },
      columns: [
      // 表头
    //   {
    //     type: "selection",
    //     width: 60,
    //     align: "center"
    //   },
      {
        type: "index",
        width: 60,
        align: "center"
      },
      {
        title: "分红人",
        key: "nickName",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "分红人手机号",
        key: "mobile",
        minWidth: 150,
        sortable: false,
      },
      {
        title: "订单编号",
        key: "orderNum",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "订单总金额（元）",
        key: "profitTotalMoney",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "分红金额（元）",
        key: "profitMoney",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "到账类型",
        key: "payType",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "状态",
        key: "profitStatus",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "创建时间",
        key: "createTime",
        minWidth: 120,
        sortable: false,
      },
      ],
      }
    },
    methods:{
      init(){
        this.getDataList()
      },
      getDataList(){
        this.loading = true;
        this.postRequest("/profitDetail/getProfitDetailList",this.searchForm).then(res =>{
          this.loading = false
          if(res.success){
            this.data = res.result.dataResult;
            this.total = res.result.totalNumber;
          } else {
            this.data = [];
            this.total = 0;
          }
        })
      },
      changeSort(e) {
        this.searchForm.sort = e.key;
        this.searchForm.order = e.order;
        if (e.order === "normal") {
          this.searchForm.order = "";
        }
        this.getDataList();
      },
      changePage(v) {
        this.searchForm.pageNumber = v;
        this.getDataList();
      },
      changePageSize(v) {
        this.searchForm.pageSize = v;
        this.getDataList();
      },
      clearSelectAll(){
        this.$refs.searchForm.resetFields()
        this.getDataList()
      },
    },
    mounted(){
      this.init()
    }
}
</script>

<style lang="less">
.search {
    .operation {
        margin-bottom: 2vh;
    }
    .select-count {
        font-size: 13px;
        font-weight: 600;  
        color: #40a9ff;
    }
    .select-clear {
        margin-left: 10px;
    }
    .page {
        margin-top: 2vh;
    }
    .drop-down {
        font-size: 13px;
        margin-left: 5px;
    }
}
</style>